import { PureComponent } from "react";
import { Button, Modal,ActivityIndicator,InputItem,NavBar,Icon } from "antd-mobile"
import { connect } from 'dva';
import { Row, Col } from 'antd';
import { routerRedux } from 'dva/router';
import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
import { handleImg, goToPage,isNull } from "../../utils/helper";
import MToast from '../../components/Util/MToast';
@connect(() => {
  return ({

  })
})
export default class Chat extends PureComponent{
  constructor(props){
    super(props);
    this.state = {
      chatItem:[],
      loading:true,
    }
  }
  componentWillMount(){
    let {dispatch,location} = this.props;
    dispatch({
      type: "global/setHeaderTitle",
      payload: {
        title: T("Informazioni di contatto 联系门店"),
        path: location.pathname + location.search
      }
    });
    dispatch({
      type: "form/query",
      payload: {
        apiInfo: {
          url: "qry/row?_c=shop_info",
          params: [
            {
              key: "store_id",
              value: localStorage.getItem("store_id")
            }
          ],
          _c: "shop_info"
        },
        callback: (result) => {
          let { data } = result;
          console.log(data);
          this.setState({
            chatItem:data,
            loading:false,
          })
        }
      }
    });
  }


  render(){
    let {dispatch} = this.props;
    let {chatItem,loading} = this.state;
    if (loading) {
      return (
        <div className="normal">
          <ActivityIndicator toast text="正在加载" animating={true} />
        </div>
      )
    }
    return(
      <div style={{height:"100%",position: 'relative',background:'#fff'}}>
        <div style={{width:'100%',padding:'2% 0px 0px 0px'}}>
          <Row style={{width:'100%',padding:'15% 0px 0% 4%'}}>
            <Col span={2} >
              <img src="image/shop.png" style={{width:'24px',height:'24px'}}/>
            </Col>
            <Col span={2}></Col>
            <Col span={20} style={{borderBottom:'1px solid #DDE3E9',paddingBottom:'4%'}}>{chatItem.store_name}</Col>

          </Row>
          <Row style={{width:'100%',padding:'4% 0px 0% 4%'}}>
            <Col span={2} >
              <img src="image/name.png" style={{width:'24px',height:'24px'}}/>
            </Col>
            <Col span={2}></Col>
            <Col span={20} style={{borderBottom:'1px solid #DDE3E9',paddingBottom:'4%'}}>{chatItem.linkman}</Col>

          </Row>
          <Row style={{width:'100%',padding:'4% 0px 0% 4%'}}>
            <Col span={2} >
              <img src="image/phone.png" style={{width:'24px',height:'24px'}}/>
            </Col>
            <Col span={2}></Col>
            <Col span={20} style={{borderBottom:'1px solid #DDE3E9',paddingBottom:'4%'}}>{chatItem.tel}</Col>

          </Row>
          <Row style={{width:'100%',padding:'4% 0px 0% 4%'}}>
            <Col span={2} >
              <img src="image/chat.png" style={{width:'24px',height:'24px'}}/>
            </Col>
            <Col span={2}></Col>
            <Col span={20} style={{borderBottom:'1px solid #DDE3E9',paddingBottom:'4%'}}>{chatItem.wechat}</Col>

          </Row>
          <Row style={{width:'100%',padding:'4% 0px 0% 4%'}}>
            <Col span={2} >
              <img src="image/tel.png" style={{width:'24px',height:'24px'}}/>
            </Col>
            <Col span={2}></Col>
            <Col span={20} style={{borderBottom:'1px solid #DDE3E9',paddingBottom:'4%'}}>{chatItem.whatsapp}</Col>

          </Row>
          <Row style={{width:'100%',padding:'4% 0px 0% 4%'}}>
            <Col span={2} >
              <img src="image/email.png" style={{width:'24px',height:'24px'}}/>
            </Col>
            <Col span={2}></Col>
            <Col span={20} style={{borderBottom:'1px solid #DDE3E9',paddingBottom:'4%'}}>{chatItem.email}</Col>

          </Row>
          <Row style={{width:'100%',padding:'4% 0px 0% 4%'}}>
            <Col span={2} >
              <img src="image/address1.png" style={{width:'24px',height:'24px'}}/>
            </Col>
            <Col span={2}></Col>
            <Col span={20} style={{borderBottom:'1px solid #DDE3E9',paddingBottom:'4%'}}>{chatItem.full_address}</Col>

          </Row>
        </div>

      </div>
    )
  }
}

